package com.hieu.android.designpattern.factory;

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.hieu.android.designpattern.R;

public class FactoryMainActivity extends Activity {

	ShapeFactory shFactory = null;
	TextView tv1;
	Button btn1;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_factory_main);
		
		shFactory = ShapeFactory.getInstanceFactory();
		shFactory.setActivity(FactoryMainActivity.this);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.factory_main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		// Handle action bar item clicks here. The action bar will
		// automatically handle clicks on the Home/Up button, so long
		// as you specify a parent activity in AndroidManifest.xml.
		int id = item.getItemId();
		if (id == R.id.action_settings) {
			return true;
		}
		return super.onOptionsItemSelected(item);
	}
	
	private class TimerChangeFactoryObject extends AsyncTask<Integer, View, Boolean> {

		@Override
		protected Boolean doInBackground(Integer... params) {
			for (int i = 0; i < 100; i++) {
				if(i%4 == 0) {
					
				}
			}
			return null;
		}

		@Override
		protected void onProgressUpdate(View... values) {
			super.onProgressUpdate(values);
			
		}
		
	}
}
